import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import About from '../views/About.vue'
import Products from '../views/Products.vue'
import News from '../views/News.vue'
import Production from "../views/Production.vue";
import Artists from "../views/Artists.vue";
import Opus from "../views/Opus.vue";
import NewsDetail from "@/components/news/NewsDetail.vue";

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/about',
        name: 'About',
        component: About
    },
    {
        path: '/products',
        name: 'Products',
        component: Products
    },
    {
        path: '/news',
        name: 'News',
        component: News,
        children: [
            {
                path: ':id', // 相对路径，实际路径为 /news/:id
                name: 'NewsDetail',
                component: NewsDetail,
                props: true
            }
        ]
    },
    {
        path: '/opus',
        name: 'Opus',
        component: Opus
    },
    {
        path: '/artists',
        name: 'Artists',
        component: Artists
    },
    {
        path: '/production',
        name: 'Production',
        component: Production
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
